package com.fulong.service.Job;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.sound.midi.Soundbank;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;


public class DeviceSqlJob implements Job {
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
            try {
                JobDataMap mergedJobDataMap = jobExecutionContext.getMergedJobDataMap();
                JdbcTemplate jdbcTemplate = (JdbcTemplate) mergedJobDataMap.get("jdbcTemplate");
                List<Map<String, Object>> tasksql = jdbcTemplate.queryForList(mergedJobDataMap.get("tasksql").toString());
                System.out.println(new SimpleDateFormat("yyyy-MM-dd:hh:mm:ss").format(new Date())+"\t"+tasksql.size());
            } catch (Exception e) {
                e.printStackTrace();
            }
    }
}
